package cn.starrysky.hrm.controller;

import cn.starrysky.hrm.dto.SmsCodeDto;
import cn.starrysky.hrm.service.IVerifycodeService;
import cn.starrysky.hrm.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/verifycode")
public class VerifycodeController {
    @Autowired
    private IVerifycodeService verifycodeService;

    @GetMapping("/imageCode/{key}")
    public AjaxResult getImageCode(@PathVariable("key") String key){
        String imageCode = verifycodeService.getImageCode(key);
        return AjaxResult.me().setResultObj(imageCode);
    }
    @PostMapping("/sendSmsCode")
    public AjaxResult sendSmsCode(@RequestBody SmsCodeDto dto){
        verifycodeService.sendSmsCode(dto);
        return AjaxResult.me();
    }
}
